Add flag to make SELinux label failure fatal, add hack for /proc
authorColin Walters <walters@verbum.org>
Wed, 29 Mar 2017 20:51:39 +0000 (16:51 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 4 Apr 2017 15:31:49 +0000 (15:31 +0000)
commit9016e9e8be4d33b31718c407a5302263ccb5eb70
tree814718418a0ee6a75546090e16ad1b1a2a046c87
parent8d4dec1b531f8cb6080887362a897f78c13fd098
Add flag to make SELinux label failure fatal, add hack for /proc

I was working on `rpm-ostree livefs` which does some ostree-based
filesystem diffs, and noticed that we were ending up with `/proc`
not being labeled in our base trees.

Reading the selinux-policy source, indeed we have:

```
/proc -d <<none>>
/proc/.* <<none>>
```

This dates pretty far back.  We really don't want unlabeled
content in ostree.  In this case it's mostly OK since the kernel
will assign a label, but again *everything* should be labeled via
OSTree so that it's all consistent, which will fix `ostree diff`.

Notably, `/proc` is the *only* file path that isn't covered when composing a
Fedora Atomic Host. So I added a hack here to hardcode it (although I'm a bit
uncertain about whether it should really be `proc_t` on disk before systemd
mounts or not).

Out of conservatism, I made this a flag, so if we hit issues down the line, we
could easily change rpm-ostree to stumble on as it did before.

Closes: #768
Approved by: jlebon
src/libostree/ostree-repo-commit.c
src/libostree/ostree-repo.h
src/libostree/ostree-sepolicy.c